import {PropType, type VNode} from 'vue'
import {ElFormItem} from "@/components/AForm/types";

export interface TableColumn{
  type?:'default' | 'selection' | 'index' | 'expand',
  index?:((index: number) => number)|number
  label:string,
  'column-key'?:string,
  prop?:string,
  width?:string|number,
  'min-width'?:string|number,
  fixed?:'left' | 'right'|boolean,
  formatter?:(row: any, column: any, index: number) => VNode | string,
  align?:'left' | 'center' | 'right',
  filters?:Array<{text: string, value: string}>,
  'filter-placement'?:'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end',
  'filter-multiple'?:boolean,
  'filtered-value'?:string[],
  'sortable'?:boolean|string,
  'sort-method'?:<T = any>(a: T, b: T) => number,
  'sort-by'?:((row: any, index: number) => string)|string|string[],
  'sort-orders'?:('ascending' | 'descending' | null)[],
  resizable?:boolean,
  selectable?:(row: any, index: number) => boolean,
  slot?:string,
  'show-overflow-tooltip'?:boolean,
  useFilter?:boolean,
  queryForms?:ElFormItem[]
  _filter?:any
}

export type LoadFunction=(query:any)=>Promise<PageResult<any>|[]>
